#include "ros/ros.h"
#include <map>

int main(int argc, char *argv[]) {
    setlocale(LC_ALL, "");
    ros::init(argc, argv, "subscriber");
    ros::NodeHandle nodeHandle;
    if (nodeHandle.hasParam("yukariAge")) {
        int age; nodeHandle.getParam("yukariAge", age);
        // 从RosCode获取参数
        ROS_INFO("Yukari is %d years old now!", age);
        std::map<std::string, int> maidAges;
        nodeHandle.getParam("maidAges", maidAges);
        for (std::pair<std::string, int> agePair : maidAges) {
            ROS_INFO("%s is %d years old now!", agePair.first.c_str(), agePair.second);
            // 这里必须使用c_str()返回char[]，即C风格字符串
        }
    }
    return 0;
}